package com.kingre.et.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 原始数据
 * 
 * @author Jingui.Yu
 * 
 */
@Entity
@Table(name = "t_dimensio_score")
public class DimensioScore extends BaseObject implements Serializable {
    private static final long serialVersionUID = 3385408763097690499L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ManyToOne(targetEntity = Dimensionality.class)
    @JoinColumn(name = "dim_id")
    private Dimensionality dimensionality;

    @ManyToOne(targetEntity = User.class)
    @JoinColumn(name = "user_id")
    private User user;

    @Column(name = "action_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date actionTime;

    @Column(name = "standard_score")
    private Integer standardScore;

    public DimensioScore() {
    }

    public DimensioScore(User user, Dimensionality dimensionality, Integer standardScore, Date actionTime) {
        this.actionTime = actionTime;
        this.standardScore = standardScore;
        this.dimensionality = dimensionality;
        this.user = user;
    }

    public Integer getId() {
        return id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Date getActionTime() {
        return actionTime;
    }

    public void setActionTime(Date actionTime) {
        this.actionTime = actionTime;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof DimensioScore)) {
            return false;
        }
        final DimensioScore rawdata = (DimensioScore) o;
        return this.hashCode() == rawdata.hashCode();
    }

    @Override
    public int hashCode() {
        return (id != null ? id.hashCode() : 0);
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE).append("id", id).append("actionTime", actionTime)
                .toString();
    }

    public Integer getStandardScore() {
        return standardScore;
    }

    public void setStandardScore(Integer standardScore) {
        this.standardScore = standardScore;
    }

    public Dimensionality getDimensionality() {
        return dimensionality;
    }

    public void setDimensionality(Dimensionality dimensionality) {
        this.dimensionality = dimensionality;
    }

}
